package part15_中介者模式_智能家居;

/**
 * @ClassName: Client
 * @Author: AllenSun
 * @Date: 2020/3/8 22:53
 */
public class Client {
    public static void main(String[] args) {
        //创建一个中介者对象
        Mediator mediator=new ConcreteMediator();
        //创建Alarm并且加入到ConcreteMediator对象的hashMap
        Alarm alarm=new Alarm(mediator,"alarm");
        //创建CoffeeMachine对象，并且加入到hashMap
        CoffeeMachine coffeeMachine=new CoffeeMachine(mediator,"coffeeMachine");
        Curtains curtains=new Curtains(mediator,"curtains");
        TV tv=new TV(mediator,"TV");

        //让闹钟发出消息
        alarm.SendMessage(0);
        coffeeMachine.FinishCoffee();
        alarm.SendMessage(1);
    }
}
